package huawei.dpoint;

/**
 * https://leetcode-cn.com/problems/container-with-most-water/
 */
public class J11 {
    public static void main(String[] args){

    }
    public static int maxArea(int[] height) {
        int left = 0;
        int right = height.length-1;
        int max = 0;
        while (left<right){
            int area = (right-left)*Math.min(height[left],height[right]);
            max=Math.max(area,max);
            if(height[left]<height[right]){
                left++;
            }else {
                right--;
            }
        }
        return max;
    }
}
